all: hello
# Which compiler
CC = gcc  
# Where are include files kept
INCLUDE = include
LIBS = lib
SOURCES = src
# Options for development
CFLAGS = -g -Wall 
# Options for release
# CFLAGS = -O3 -Wall

hello: main.o $(LIBS)/libhello.so 
	$(CC) -o $@ $< -L$(LIBS) -Wl,-rpath=$(LIBS) -l$(@F) 

%.o: %.c
	$(CC) -c $< -I$(INCLUDE)

$(LIBS)/libhello.so: $(SOURCES)/hello.c 
	$(CC) -shared -o $@ $<

clean:
	rm -f $(LIBS)/*.so hello *.o

.PHONY: all clean
